package com.gz.view;

import com.alibaba.druid.sql.visitor.functions.Char;
import com.gz.domain.Bill;
import com.gz.domain.DiningTable;
import com.gz.domain.Employee;
import com.gz.domain.Menu;
import com.gz.service.BillService;
import com.gz.service.DiningTableService;
import com.gz.service.EmployeeService;
import com.gz.service.MenuService;
import com.gz.utils.Utility;

import java.util.List;

public class MHLview {
    private boolean loop =true;
    private String key="";
    private EmployeeService employeeService=new EmployeeService();
    private Function function=new Function();


    public static void main(String[] args) {
        new MHLview().mainMenu();
    }


    public void mainMenu(){
        while(loop){
            System.out.println("================满汉楼==============");
            System.out.println("\t\t1 登录满汉楼");
            System.out.println("\t\t2 退出满汉楼");
            System.out.println("请输入你的选择: ");
            key= Utility.readString(1);
            switch (key){
                case "1":
                    System.out.println("请输入员工号: ");
                    String empId=Utility.readString(50);
                    System.out.println("请输入密 码: ");
                    String pwd=Utility.readString(50);
                    Employee employee = employeeService.getEmployeeByempIdandPwd(empId, pwd);

                    if(employee!=null){
                        System.out.println("================登陆成功["+employee.getName()+"]==============\n");
                        //显示二级菜单
                        while(loop){
                            System.out.println("================满汉楼(二级菜单)==============");
                            System.out.println("\t\t1 显示餐桌状态");
                            System.out.println("\t\t2 预定餐桌");
                            System.out.println("\t\t3 显示所有菜品");
                            System.out.println("\t\t4 点餐服务");
                            System.out.println("\t\t5 查看账单");
                            System.out.println("\t\t6 结账");
                            System.out.println("\t\t9 退出满汉楼");
                            System.out.println("请输入你的选择: ");
                            key= Utility.readString(1);
                            switch (key){
                                case "1":
                                    function.listdiningTable();
                                    break;
                                case "2":
                                    function.orderDingTable();
                                    break;
                                case "3":
                                    function.listMenu();
                                    break;
                                case "4":
                                    function.orderMenu();
                                    break;
                                case "5":
                                    function.listBill();
                                    break;
                                case "6":
                                    function.payBill();
                                    break;
                                case "9":
                                    loop=false;
                                    break;
                                default:
                                    System.out.println("你输入有误，请重新输入");
                            }

                        }

                    }
                    else
                        System.out.println("================登陆失败==============\n");
                    break;
                case "2":
                    System.out.println("退出满汉楼");
                    loop=false;
                    break;
                default:
                    System.out.println("你输入有误，请重新输入");
            }
        }

    }
}
